package com.jk.controller;

import com.jk.OrderBean;
import com.jk.UserBean;
import com.jk.UserInfo;
import com.jk.service.CxhUserServer;
import com.jk.service.UserService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;

/**
 * @Author 程旭航
 * @Create 2021/5/21 - 10:36
 * @Description
 */
@RestController
public class UserController implements CxhUserServer {

    @Autowired
    private UserService2 userService2;


    /**
     * @Author:程旭航
     * @Description: 发送验证码
     * @Date: 2021/5/26 11:54
     * @param phone
     * @param typ
     * @Return: java.lang.String
     **/
    @Override
    public String sendCode( String phone,String typ) {
        String s = userService2.sendCode(phone, typ);
        return s;
    }

    /***
     * @Author:程旭航
     * @Description: 快捷登录
     * @Date: 2021/5/26 11:54
     * @param phone
     * @param code
     * @param typ
     * @Return: java.lang.String
     **/
    @Override
    public HashMap<String, Object> quickLogin(String phone, String code, String typ) {
        return userService2.quickLogin( phone,  code,typ);
    }

    @Override
    public HashMap<String, Object> login(String userName, String userPwd) {
        return userService2.login( userName,  userPwd);
    }

    /**
     * @Author:程旭航
     * @Description: 账号登陆
     * @Date: 2021/5/26 11:54
     * @param userName
     * @param userPwd
     * @Return: java.lang.String
     **/


    /**
     * @Author:程旭航
     * @Description: 修改密码
     * @Date: 2021/5/26 11:54
     * @param phone
     * @param userPwd
     * @Return: java.lang.String
     **/
    @Override
    public String upPwd(String phone,String userPwd) {
        return userService2.upPwd(phone,userPwd);
    }

    /***
     * @Author:程旭航
     * @Description: 新增用户
     * @Date: 2021/5/26 11:55
     * @param user
     * @param code
     * @param typ
     * @Return: java.lang.String
     **/
    @Override
    public String addUser(UserBean user, String code,String typ) {
        return userService2. addUser( user,  code,typ);
    }

    /**
     * @Author:程旭航
     * @Description: 查询订单
     * @Date: 2021/5/26 11:55
     * @param phone
     * @Return: java.util.List<java.io.Serializable>
     **/

    @Override
    public List<OrderBean> queryOrder(String phone, Integer page, Integer rows) {
        return userService2. queryOrder(phone,  page,  rows);
    }

    /**
     * @Author:程旭航
     * @Description: 修改用户信息
     * @Date: 2021/5/28 16:40
     * @param user
     * @Return: java.lang.String
     **/
    @Override
    public String updateUserInfo(UserInfo user) {
        return  userService2. updateUserInfo( user) ;
    }

    /**
     * @Author:程旭航
     * @Description: 查询用户
     * @Date: 2021/5/28 17:36
     * @param userId
     * @Return: com.jk.UserInfo
     **/
    @Override
    public UserInfo queryUserInfo(Integer userId) {
        return userService2. queryUserInfo( userId) ;
    }

    /**
     * @Author:程旭航
     * @Description: 注销登录
     * @Date: 2021/5/30 14:23
     * @param
     * @Return: void
     **/
    @Override
    public void logout() {
        userService2. logout() ;
    }

    @Override
    public void delOrder(String orderId, String phone) {
        userService2. delOrder(orderId, phone) ;
    }

    @Override
    public OrderBean queeryOrder(String orderId, String state, String phone) {
        return  userService2. queeryOrder(orderId,state, phone) ;
    }

    @Override
    public OrderBean queryDetails(String orderId) {
        return userService2.queryDetails( orderId);
    }


}
